package team.first.movieapiv2pro.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import team.first.movieapiv2pro.domain.Region;
import team.first.movieapiv2pro.service.RegionService;
import team.first.movieapiv2pro.vo.ApiResponse;

import java.util.List;

/**
 * @Author: HAPPY
 * @Project_name: project
 * @Package_name: team.first.movieapiv2.controller
 * @Date: 2021/12/9 12:55
 * @Description:
 */
@RestController
public class RegionController {
    @Autowired
    private RegionService regionService;

    /**
     * 获取全部电影地区信息
     * 接口地址：GET /api/v2/regions
     */
    @ApiOperation("1.1 GET: 获取全部电影类型信息")
    @GetMapping("/api/v2/regions")
    public ApiResponse<List<Region>> getAllGenres() {
        ApiResponse<List<Region>> apiResponse = new ApiResponse<>();

        List<Region> regionList = regionService.list();

        apiResponse.setCode(200).setSuccess(true).setMessage("请求成功").setData(regionList);
        return apiResponse;
    }
}
